home *** CD-ROM | disk | FTP | other *** search
- # include <Palettes.h>
-
- # define BASE_RES_ID 400
- # define NIL_POINTER 0L
- # define MOVE_TO_FRONT -1L
- # define CLUT_ID 130
- # define PALETTE_ID 1288
- # define SRC_USAGE 2
- # define SRC_TOLERANCE 0
- # define REMOVE_ALL_EVENTS 0
- # define BallWidth 10
- # define BallHeight 10
-
-
- WindowPtr gHelloWindow;
- RGBColor myRGB;
- Point *mouseLoc;
- int x,y,c, top, bottom;
- PaletteHandle gThePalette;
- CTabHandle gTheCLUT;
- Rect myRect;
-
-
-
- /******************** Main ********************/
- main()
- {
- ToolBoxInit();
- WindowInit();
- }
-
-
-
- /******************** ToolBoxInit ********************/
- ToolBoxInit()
-
- {
- InitGraf ( &qd.thePort );
- InitFonts();
- FlushEvents ( everyEvent, 0 );
- InitWindows();
- InitMenus();
- TEInit();
- InitDialogs( 0L );
- InitCursor();
- }
-
-
- /******************** WindowInit ********************/
- WindowInit ()
- {
-
- gHelloWindow = GetNewCWindow ( BASE_RES_ID, 0L, (WindowPtr)-1L );
- SetPort ( gHelloWindow );
- gTheCLUT = GetCTable ( CLUT_ID );
- gThePalette = GetNewPalette ( PALETTE_ID );
- CTab2Palette ( gTheCLUT, gThePalette, 2, 0);
- SetPalette ( gHelloWindow, gThePalette, TRUE );
- ActivatePalette ( gHelloWindow );
- while ( !Button() )
- {
- for ( x=1; x<18; x++)
- {
- top = x * 18;
- for ( y=1; y<18; y++)
- {
- bottom = y * 18;
- SetRect ( &myRect, bottom, top, bottom+15, top+15 );
- c++;
- if ( c > 256 )
- c = 0;
- PmForeColor ( c );
- PaintRect ( &myRect );
- }
- }
- }
- }